(()=>{((c,Ze,Yn,Qn=50,Ut=50*1024,et=512*1024,je=100,Zn=5*1024*1024,Fe=50,Ot=600*1e3,er=2e3)=>{const Nt=c.__lovableEvents||{};if(Nt.__userAppEventsSdkVersion)return;const f=c.document,ce=c.navigator||{},Vt=ce.webdriver===!0||!!c.Cypress||!!c.__nightmare,x=c.performance||{now:()=>Date.now()},j=c.location||{pathname:"",href:"",search:""},ne=()=>c.setTimeout||(typeof setTimeout=="function"?setTimeout:null),ue=()=>c.clearTimeout||(typeof clearTimeout=="function"?clearTimeout:null),Bt=()=>c.fetch||(typeof fetch=="function"?fetch:null);if((e=>e==="/__codex_token_check"||e.startsWith("/__l5e/"))(j.pathname))return;const b=f&&f.currentScript,Dt=b?{kind:b.getAttribute("data-artifact-kind")||null,id:b.getAttribute("data-artifact-id")||null,commit_sha:b.getAttribute("data-commit-sha")||null,context_token:b.getAttribute("data-context-token")||null}:{},$t=(b==null?void 0:b.getAttribute("data-replay"))||null,tt=(()=>{try{const e=new URL((b==null?void 0:b.src)||"").pathname,t=e.lastIndexOf("/__l5e/");return t>0?e.slice(0,t):""}catch{return""}})(),tr=(b==null?void 0:b.getAttribute("data-track-url"))||`${tt}/__l5e/trackevents`,nr=(b==null?void 0:b.getAttribute("data-replay-url"))||`${tt}/__l5e/replay`,rr=(b==null?void 0:b.getAttribute("data-replay-script-url"))||`${tt}/__l5e/rrweb-record.js`,zt=e=>{const t=typeof e=="string"?Number(e):0;return!Number.isFinite(t)||t<=0?0:t>=1?1:t},nt=zt((b==null?void 0:b.getAttribute("data-replay-sample-rate"))||null),rt=zt((b==null?void 0:b.getAttribute("data-replay-crash-sample-rate"))||null),or=(b==null?void 0:b.getAttribute("data-autocapture"))==="1",ot=(b==null?void 0:b.getAttribute("data-consent"))==="1";let de=null,lt=!1,Ue=!1;const qt=e=>{const t=new Uint8Array(e);if(c.crypto&&typeof c.crypto.getRandomValues=="function")c.crypto.getRandomValues(t);else for(let n=0;nArray.from(e,t=>t.toString(16).padStart(2,"0")).join(""),M=()=>{if(c.crypto&&typeof c.crypto.randomUUID=="function")return c.crypto.randomUUID();const e=qt(16);e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Ht(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`},at=e=>{const t=qt(e);return t.every(n=>n===0)&&(t[t.length-1]=1),Ht(t)},Wt=()=>({traceId:at(16),rootSpanId:at(8)}),st=M();let it=null,Oe=M(),ct=0,fe=Wt(),ut=0,re=null;const Jt=[1e4,3e4,6e4,3e5];let dt=0,Ne=null;const lr=144e5;let ft=0,Ve=!1;const Gt=18e5;let oe=null,Be=0,Kt=0,pe=!1;const Xt=(e=>{let t=2166136261;for(let n=0;n>>0)/4294967296})(st),W=nt>0&&Xt0&&Xte.replace(/[^\s]/gu,"*"),fr=(e,t)=>{var n;if(typeof(t==null?void 0:t.tagName)=="string"&&t.tagName.toUpperCase()==="STYLE")return e;const r=t&&typeof t.closest=="function"?t.closest.bind(t):null,o=r==null?void 0:r("[data-lovable-unmask]");return(n=o==null?void 0:o.matches)!=null&&n.call(o,dr)&&!(r!=null&&r(`.rr-mask,${ir}`))?e:Zt(e)},N=[],V=[],le=[],pr=500;let mt=null;const en=1800;let gt=en,He=null;const ae=new Map,tn=new WeakSet,nn=new WeakSet;let yt=0,rn=0,on=!1,ve=null,ke=!1,ln=!1,an=!1,Q=!1,sn=0,hr=0;const bt=Math.max(1,Qn),mr=5,gr=200,yr=/^project\.[a-z][a-z0-9_]{0,63}(\.[a-z][a-z0-9_]{0,63})*$/u,br=e=>{const t=Yn[e];return typeof t=="number"&&t>0?t:yr.test(e)?1:null},cn=typeof TextEncoder=="function"?new TextEncoder:null,G=e=>cn?cn.encode(e).length:e.length,un=e=>JSON.stringify({envelope_schema_version:1,batch_id:M(),sent_at:new Date().toISOString(),sdk:{name:"lovable-user-app-events",version:Ze},automated:Vt,artifact:Dt,events:e}),dn=e=>{const t=c.console;t&&typeof t.debug=="function"&&t.debug(`[lovable-analytics] ${e}`)},_r=(e,t)=>{if((e===403||e===404)&&t==="rejected"){ke=!0,N.length=0,V.length=0,le.length=0,an||(an=!0,dn(`events disabled for this page load (HTTP ${e})`));return}ln||(ln=!0,dn(`event batch rejected (HTTP ${e})`))},fn=64*1024,pn=16*1024;let Se=0,_t=0;const hn=()=>{Se-=_t,_t=0},mn=(e,t,n)=>{var r,o;const l=G(t),a=fn-(n.reserveBytes||0),i=!!n.keepalive&&Se+l<=a;i&&(Se+=l);let u=i;const p=()=>{u&&(u=!1,Se-=l)},y=c.Blob||(typeof Blob=="function"?Blob:null);if(i&&n.beacon&&ce.sendBeacon&&y)try{if(ce.sendBeacon(e,new y([t],{type:"application/json"}))){_t+=l,u=!1;return}}catch{}const w=Bt();if(!w){p(),(r=n.onNetworkError)==null||r.call(n);return}try{Promise.resolve(w(e,{method:"POST",headers:{"content-type":"application/json"},body:t,...i?{keepalive:!0}:{}})).then(I=>{var q;p(),(q=n.onResponse)==null||q.call(n,I)},()=>{var I;p(),(I=n.onNetworkError)==null||I.call(n)}).catch(()=>{})}catch{p(),(o=n.onNetworkError)==null||o.call(n)}},vr=()=>{if(lt)return;lt=!0;const e=n=>{de=n,Ue=!0,(V.length>0||le.length>0)&&K()},t=Bt();if(!t){Ue=!0;return}try{Promise.resolve(t("/cdn-cgi/trace",{})).then(n=>n&&n.ok?n.text():"").then(n=>{var r,o,l,a;const i=typeof n=="string"?n:"",u=(o=(r=/^h=(.+)$/m.exec(i))==null?void 0:r[1])==null?void 0:o.trim().toLowerCase().replace(/:\d+$/,"");if(!u||u!==(j.hostname||"").toLowerCase())return e(null);const p=(a=(l=/^loc=([A-Z0-9]{2})$/m.exec(i))==null?void 0:l[1])!=null?a:null;e(p==="XX"||p==="T1"?null:p)}).catch(()=>e(null))}catch{e(null)}},gn=(e,t)=>{const n=e.filter(o=>{try{return JSON.stringify(o),!0}catch{return!1}});let r=0;for(;r=pn?Math.min(Ut,a):Ut;for(;o-r>1&&G(l)>i;)o=r+Math.max(1,Math.floor((o-r)/2)),l=un(n.slice(r,o));mn(tr,l,{keepalive:!0,beacon:t,onResponse:u=>{var p,y,w;!u||u.ok!==!1||_r(u.status,(w=(y=(p=u.headers)==null?void 0:p.get)==null?void 0:y.call(p,"x-lovable-events"))!=null?w:null)}}),r=o}},vt=(e,t,n)=>_?JSON.stringify({envelope_schema_version:1,replay_schema_version:1,replay_id:_,chunk_id:t,chunk_sequence:n,sent_at:new Date().toISOString(),sdk:{name:"lovable-user-app-events",version:Ze},automated:Vt,artifact:Dt,session_id:st,page_view_id:Oe,events:e}):null,kr=e=>{const t=vt([e],"00000000-0000-4000-8000-000000000000",B);return!!t&&G(t)<=et},yn=e=>{const t=e&&typeof e=="object"?e:null;return typeof(t==null?void 0:t.type)=="number"?t.type:null},kt=()=>Math.max(0,x.now()-pt),bn=()=>{if(!be)return;const e=ue();e&&e(be),be=null},We=()=>{if(!De)return;const e=ue();e&&e(De),De=null},St=()=>{try{he==null||he()}catch{}finally{he=null,_e=!1}},Sr=e=>{switch(e){case"recorder_script_failed":return"recorder_script";case"recorder_start_failed":return"recorder_start";case"recorder_runtime_error":return"recorder_runtime";case"missing_full_snapshot":case"full_snapshot_too_large":return"snapshot";case"upload_failed":return"upload";default:return null}},_n=(e,t,n,r,o,l)=>{const a=Sr(t);a&&A("lovable.replay_error",{replay_id:e,reason:t,stage:a,recorder:"rrweb",sample_rate:Qt,event_count:n,duration_ms:r,chunk_count:o,uploaded_bytes:l})},Er=()=>!$||$==="sampled"?{}:{capture_reason:$,trigger_event_id:ze,trigger_event_name:qe},vn=(e,t,n,r,o,l,a)=>{A("lovable.session_replay",{replay_id:e,status:t,reason:n,recorder:"rrweb",sample_rate:Qt,event_count:r,duration_ms:o,chunk_count:l,uploaded_bytes:a,...Er()}),_n(e,n,r,o,l,a)},Et=(e,t)=>{_&&vn(_,e,t,O,kt(),B,Y)},Tt=()=>D||$==="sampled",wt=(e,t,n,r,o,l,a)=>{Tt()?vn(e,t,n,r,o,l,a):_n(e,n,r,o,l,a)},z=(e,t=!1)=>{!_||T||(St(),We(),t&&(C.length=0,bn()),Tt()&&Et("stopped",e),T=!0)},kn=()=>{if(!(!_||T)){if(!D){St(),We();return}z("duration_limit",!0)}},Sn=e=>{!_||T||$==="client_error"||(D=!0,$="client_error",ze=e,qe="lovable.client_error",En())},Tr=()=>C.length>0||B>0||Y>0,En=()=>!_||T||$!=="client_error"||ht||!J||!Tr()?!1:(ht=!0,Et("captured","client_error"),se(!0),!0),Tn=e=>{if(ge>0){ye=e;return}z(e,!0)},wn=()=>{if(ge--,T||ge>0||!ye)return;const e=ye;ye=null,me>0?xn():z(e,!0)},se=(e=!1)=>{if(bn(),!(!D||!_||C.length===0||!J))for(;!T&&C.length>0;){let t=Math.min(C.length,je);const n=M(),r=B;let o=vt(C.slice(0,t),n,r);for(;o&&t>1&&G(o)>et;)t=Math.max(1,Math.floor(t/2)),o=vt(C.slice(0,t),n,r);if(!o)return;const l=G(o);if(l>et){C.shift(),O=Math.max(0,O-1);continue}const a=B-me;if(a>=Fe||Y+l>Zn){Tn(a>=Fe?"chunk_limit":"size_limit");return}if(C.splice(0,t),B++,Y+=l,ge++,mn(nr,o,{keepalive:e,reserveBytes:pn,onResponse:i=>{var u,p;const y=(i==null?void 0:i.status)===429;if(y&&(me++,Y-=l,O=Math.max(0,O-t)),wn(),y||i&&i.ok!==!1)return;const w=(p=(u=i==null?void 0:i.headers)==null?void 0:u.get)==null?void 0:p.call(u,"x-lovable-events");z(w==="unavailable"?"upload_unavailable":w==="rejected"?"upload_rejected":"upload_failed",!0)},onNetworkError:()=>{z("upload_failed",!0),wn()}}),T)return;if(B-me>=Fe){Tn("chunk_limit");return}}},xn=()=>{if(be)return;const e=ne();if(!e){se();return}be=e(se,er)},wr={"lovable.session_started":!0,"lovable.page_viewed":!0,"lovable.page_engagement":!0,"lovable.web_vital":!0,"lovable.client_error":!0,"lovable.resource_error":!0},xr=(e,t)=>{if(e==null)return 0;const n=(Array.isArray(e)?e:[e]).map(r=>String(r).toUpperCase());return de&&n.includes(de)?1:t!=="denied"?-1:de?n.some(r=>r.startsWith(`${de}-`))?2:-1:1},ie=()=>{try{if(ce.globalPrivacyControl===!0)return"denied";const e=c.dataLayer;let t=null;for(let a=0;Array.isArray(e)&&aString(I).toUpperCase()).sort());ae.delete(w),ae.set(w,{region:y,value:p}),ae.size>100&&ae.delete(ae.keys().next().value)}}}if(He=t!=null?t:He,He)return He;const n=Array.from(ae.values()),r=a=>a.region!==void 0&&a.region!==null;n.some(r)&&(n.some(a=>a.value!==n[0].value)||n.every(r)&&n[0].value==="denied")&&vr();let o=null,l=-1;for(const a of n){const i=xr(a.region,a.value);i>=0&&i>=l&&(l=i,o=a.value)}return o!=null?o:on?"denied":null}catch{return on=!0,"denied"}},Rn=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return null}},xt=e=>{const t=e.properties;return t.context===void 0?e:{...e,properties:{...t,context:{}}}},Rr=()=>{if(le.length===0)return;const e=ie()==="denied";for(const t of le.splice(0))N.push(e?xt(t):t)},Mr=()=>{V.length===0||ie()==="denied"||N.unshift(...V.splice(0,V.length))},Mn=()=>{gt=en},Cn=()=>gt<0,An=()=>{if(mt)return;if(gt--<=0){V.length=0,rn=yt;return}const e=ne();e&&(mt=e(()=>{if(mt=null,!ke){if(ie()==="denied"){V.length>0&&An();return}Mn(),V.length>0&&K()}},1e3))},Cr=()=>{if(!ve)return;const e=ue();e&&e(ve),ve=null},K=(e=!1)=>{if(Cr(),le.length>0&&(Ue||e||Q||ie()!=="denied")&&Rr(),Mr(),ke||N.length===0)return;if(e||Q){for(;N.length>0;)gn(N.splice(0,bt),!0);return}const t=N.splice(0,bt);gn(t,!1),N.length>0&&Ln()},Ln=()=>{if(ve||ke)return;const e=ne();if(!e){K();return}ve=e(K,250)},Ar=()=>{re===null&&(re=x.now())},Je=()=>{re=null},Ee=()=>{const e=ue();Ne!==null&&e&&e(Ne),Ne=null},Lr=()=>{if(re!==null){const t=x.now();ut+=t-re,re=t}const e=Math.round(ut);return ut=0,e},Te=e=>{const t=Lr();if(t<=0)return;ft+=t;const n=ft>=lr;n&&(Ve=!0,Je(),Ee()),A("lovable.page_engagement",{reason:n?"capped":e,engagement_time_ms:t})},In=()=>{Ee();const e=ne();if(!e)return;const t=Jt[Math.min(dt,Jt.length-1)];Ne=e(()=>{dt++,Te("threshold"),!Ve&&In()},t)},Rt=()=>{const e=ue();oe!==null&&(e&&e(oe),Be+=Math.max(0,x.now()-Kt)),oe=null},Pn=()=>{Rt(),Be=0},jn=()=>{var e;if(oe!==null||!f||f.visibilityState==="hidden"||((e=f.hasFocus)==null?void 0:e.call(f))!==!1)return;const t=ne();t&&(Kt=x.now(),oe=t(()=>{oe=null,Be=Gt,pe=!0,Te("unfocused"),Je(),Ee()},Math.max(0,Gt-Be)))},we=()=>{f&&f.visibilityState==="hidden"||pe||Ve||(Ar(),dt=0,In(),jn())},Fn=()=>(Te("navigation"),ft=0,Ve=!1,we(),Oe=M(),fe=Wt(),ct=0,Oe),Ir=e=>e==="lovable.page_viewed"?{trace_id:fe.traceId,span_id:fe.rootSpanId}:{trace_id:fe.traceId,span_id:at(8),parent_span_id:fe.rootSpanId},Pr=e=>e==="lovable.client_error"||e==="lovable.resource_error"||e==="lovable.replay_error",jr=(e,t,n={})=>{var r;if(ke)return null;const o=e==="lovable.client_error";if(Pr(e)&&++hr>gr)return o&&Sn(null),null;const l=o&&snrn&&Mn(),!y||V.length>=pr||Cn()||ce.globalPrivacyControl===!0?null:(V.push(y),An(),a)}return l?(sn++,N.unshift(u)):N.push(u),o&&Sn(a),l||N.length>=bt?K():Ln(),a},A=(e,t={})=>{const n=typeof e=="string"?br(e):null;return n===null?null:jr(e,n,t)};let xe=j.pathname;const Fr=(e,t={})=>(e==="lovable.page_viewed"&&(Fn(),typeof t.url_path=="string"&&(xe=t.url_path)),A(e,t)),Ur=/(^|[^a-z0-9_.-])([a-z0-9_.-]*(token|secret|password|passwd|key)|token_hash|code|email)(=|%3d)/iu,Mt=e=>Ur.test(e)?"/":e,Ct=e=>{try{const t=new URL(e,j.href);return t.protocol==="http:"||t.protocol==="https:"?Mt(t.pathname):t.pathname}catch{return null}},Un=e=>{try{return new URL(e,j.href).host.replace(/^www\./iu,"")}catch{return null}},Or=e=>{try{return new URL(e,j.href).protocol.replace(/:$/u,"")}catch{return null}},Nr=[["utm_source","campaign_source"],["utm_medium","campaign_medium"],["utm_campaign","campaign_name"],["utm_term","campaign_term"],["utm_content","campaign_content"],["utm_id","campaign_id"]],Vr=[["gclid"],["dclid"],["gbraid"],["wbraid"],["msclkid"],["ttclid"],["twclid"],["li_fat_id"],["fbclid"],["oppref"],["ko_click_id"],["irclickid","im_ref"],["via"]],Br=128,Dr=(e,t)=>{const n={};try{const r=new URLSearchParams(typeof e=="string"?e.replace(/;/gu,"&"):"");for(const[a,i]of Nr){const u=r.get(a);if(typeof u!="string")continue;const p=u.trim();p&&G(p)<=Br&&(n[i]=p)}const o=a=>{const i=r.get(a);return typeof i=="string"&&i.trim()!==""},l=Vr.filter(a=>a.some(o)).map(([a])=>a);if(!l.includes("via")&&typeof t=="string"){const a=new URLSearchParams(t.slice(1)).get("via");typeof a=="string"&&a.trim()!==""&&l.push("via")}l.length>0&&(n.campaign_click_id_types=l)}catch{return{}}return n},On=(e,t)=>{let n=e;for(;n&&G(JSON.stringify(n))>t;)n=n.slice(0,Math.floor(n.length*.8));return n},At=(e,t)=>{if(typeof e!="string")return null;const n=e.replace(/\s+/gu," ").trim();if(!n)return null;if(n.length<=t)return n;const r=Array.from(n);return r.length>t?r.slice(0,t).join(""):n},$r=2048,Nn=()=>At(Mt(j.pathname||"/"),$r)||"/",Lt=e=>{const t=e&&typeof e=="object"?e:null,n=l=>typeof l=="string"?l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?String(l):null,r=n(t==null?void 0:t.stack),o=n(t==null?void 0:t.message)||n(e)||"Unknown error";return{message:On(o.slice(0,2e3),2048),name:n(t==null?void 0:t.name),stack:r?On(r.slice(0,8e3),8192):null}},Vn=1e3,zr=1e4,Bn=10,Ge=new Map,Re=[],Dn=(e,t)=>{for(const[n,r]of Ge)t-r>=Vn&&Ge.delete(n);Ge.set(e,t)},It=(e,t=!0)=>{var n,r;t&&Fn();const o=j.pathname,l={url_path:Mt(o),navigation_type:e};typeof(f==null?void 0:f.referrer)=="string"&&f.referrer&&(l.referrer_host=(n=Un(f.referrer))!=null?n:"",l.referrer_path=(r=Ct(f.referrer))!=null?r:""),Object.assign(l,Dr(j.search,j.hash)),xe=o,Dn(o,x.now()),A("lovable.page_viewed",l)},Pt=e=>{j.pathname!==xe&&It(e)},qr=()=>{const e=j.pathname;if(e===xe)return;const t=x.now(),n=Ge.get(e);if(n!==void 0&&t-nBn+1&&Re.shift(),Re.length>Bn&&t-Re[0]{const e=$t==="rrweb"&&Yt&&c.rrweb&&typeof c.rrweb.record=="function"?c.rrweb.record:null;if(!(!e||_)){_=M(),pt=x.now(),T=!1,B=0,me=0,ge=0,ye=null,Y=0,_e=!1,J=!1,D=W,$=W?"sampled":null,ze=null,qe=null,ht=!1;try{const t=e({emit(r){if(T||!r||typeof r!="object")return;if(kt()>=Ot){kn();return}const o=yn(r);if(!kr(r)){o===2&&!J&&z("full_snapshot_too_large",!0);return}if(!(o===3&&!J)){for(o===2&&(J=!0),O+=1,C.push(r);!D&&C.length>sr;){const l=C.findIndex(a=>yn(a)!==2);C.splice(l>=0?l:0,1),O=Math.max(0,O-1)}En()||D&&(C.length>=je?se():xn())}},blockClass:"rr-block",blockSelector:cr,collectFonts:!1,ignoreClass:"rrweb-ignore",ignoreSelector:ur,inlineImages:!1,maskAllInputs:!0,maskInputFn:Zt,maskInputOptions:{checkbox:!1,color:!1,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,radio:!1,range:!1,search:!0,select:!0,tel:!0,text:!0,textarea:!0,time:!0,url:!0,week:!0},maskTextClass:"rr-mask",maskTextFn:fr,maskTextSelector:"*",recordAfter:"load",recordCanvas:!1,recordCrossOriginIframes:!1});if(T){if(typeof t=="function")try{t()}catch{}return}_e=!0,typeof t=="function"&&(he=t);const n=ne();n&&typeof e.takeFullSnapshot=="function"&&n(()=>{var r;if(!(!_||T))try{(r=e.takeFullSnapshot)==null||r.call(e,!1)}catch{}},1e3),n&&(De=n(kn,Ot)),Tt()&&Et("started","recorder_available")}catch{_&&wt(_,"stopped","recorder_start_failed",O,kt(),B,Y),_=null,O=0,pt=0,T=!1,J=!1,D=W,$=W?"sampled":null,ze=null,qe=null,he=null,_e=!1,We()}}},Hr=()=>{if($t!=="rrweb"||!Yt||_||$e||ot)return;if(c.rrweb&&typeof c.rrweb.record=="function"){$n();return}const e=f==null?void 0:f.head;if(!(f!=null&&f.createElement)||!(e!=null&&e.appendChild))return;const t=f.createElement("script");$e=!0,t.async=!0,t.src=rr,t.onload=()=>{if($e=!1,!c.rrweb||typeof c.rrweb.record!="function"){wt(M(),"stopped","recorder_script_failed",0,0,0,0);return}$n()},t.onerror=()=>{$e=!1,wt(M(),"stopped","recorder_script_failed",0,0,0,0)},e.appendChild(t)},Wr=e=>{if(!(!_||T)){if(St(),We(),!J){z("missing_full_snapshot",!0);return}se(!0),T||z(e)}},Jr=e=>{if(!_||T)return;const t=e&&typeof e=="object"?e:null,n=t!=null&&t.error&&typeof t.error=="object"?t.error:null,r=typeof(t==null?void 0:t.filename)=="string"?t.filename:"",o=typeof(n==null?void 0:n.stack)=="string"?n.stack:"";(r.includes("/__l5e/rrweb-record")||o.includes("/__l5e/rrweb-record"))&&z("recorder_runtime_error",!0)},Gr=(e,t)=>{const r={CLS:[.1,.25],FCP:[1800,3e3],INP:[200,500],LCP:[2500,4e3],TTFB:[800,1800]}[e];return!r||t<=r[0]?"good":t<=r[1]?"needs-improvement":"poor"},Kr=e=>e==="CLS"?"score":"millisecond",L=(e,t)=>{const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null},Ke=(e,t)=>{const n=c.PerformanceObserver;if(!n)return!1;const r=n.supportedEntryTypes;if(Array.isArray(r)&&!r.includes(e))return!1;try{return new n(l=>{const a=typeof l.getEntries=="function"?l.getEntries():[];for(const i of a)i&&typeof i=="object"&&t(i)}).observe(e==="event"?{type:e,buffered:!0,durationThreshold:40}:{type:e,buffered:!0}),!0}catch{return!1}},Xr=()=>{var e;const t=Nn(),n=(h,m,S=m,X=M())=>{!Number.isFinite(m)||m<0||A("lovable.web_vital",{url_path:t,metric:h,value:m,unit:Kr(h),delta:S,rating:Gr(h,m),id:X,navigation_type:"initial_load"})};let r=!1,o=null,l=0,a=0,i=1/0,u=1/0,p=!1;const y={},w={},I=h=>(y[h]=y[h]||M(),y[h]),q=(h,m)=>{if(w[h]===m)return;const S=w[h];w[h]=m,n(h,m,S===void 0?m:m-S,I(h))},Me=h=>(typeof x.getEntriesByType=="function"?x.getEntriesByType(h):[]).filter(m=>!!m&&typeof m=="object"),R=(e=Me("navigation")[0])!=null?e:null,Z=R?L(R,"responseStart"):null,Xe=R?L(R,"requestStart"):null,jt=R?L(R,"fetchStart"):null,Ce=Xe!=null?Xe:jt;Z!==null&&Ce!==null&&Z>=Ce&&n("TTFB",Z-Ce);const Ye=()=>{var h;const m=Math.max((h=R?L(R,"activationStart"):null)!=null?h:0,0),S=Me("visibility-state").find(P=>{const F=L(P,"startTime");return P.name==="hidden"&&F!==null&&F>=m}),X=S?L(S,"startTime"):(f==null?void 0:f.visibilityState)==="hidden"?0:null;X!==null&&(i=Math.min(i,X)),Ke("paint",P=>{if(r||P.name!=="first-contentful-paint")return;const F=L(P,"startTime");F!==null&&(r=!0,F{var F,Ae;const ee=(Ae=(F=L(P,"startTime"))!=null?F:L(P,"renderTime"))!=null?Ae:L(P,"loadTime");ee===null||ee>=i||ee>=u||(o=Math.max(ee-m,0))})};if((f==null?void 0:f.prerendering)===!0&&typeof f.addEventListener=="function"?f.addEventListener("prerenderingchange",Ye,{once:!0}):Ye(),f&&typeof f.addEventListener=="function"){const h=["keydown","click"],m=S=>{if(!(!S||typeof S!="object"||S.isTrusted!==!0)&&(u=Math.min(u,x.now()),typeof f.removeEventListener=="function"))for(const X of h)f.removeEventListener(X,m,!0)};for(const S of h)f.addEventListener(S,m,!0)}const Ft=Ke("layout-shift",h=>{if(h.hadRecentInput===!0)return;const m=L(h,"value");m!==null&&(l+=m)});return Ke("event",h=>{const m=L(h,"interactionId");if(m===null||m<=0)return;const S=L(h,"duration");S!==null&&S>a&&(a=S)}),(h=!1)=>{p||(i=Math.min(i,x.now()),o!==null&&q("LCP",o),Ft&&q("CLS",l),a>0&&q("INP",a),h&&(p=!0))}},zn=(e,t)=>{const n=c.history,r=n&&n[e];!n||typeof r!="function"||(n[e]=function(...o){const l=r.apply(this,o);return t(),l})},Yr=e=>{const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=typeof t.mechanism=="string"?t.mechanism:"manual",r=typeof t.severity=="string"?t.severity:"error";return{mechanism:["manual","onerror","unhandledrejection","react_error_boundary"].includes(n)?n:"manual",handled:typeof t.handled=="boolean"?t.handled:!0,severity:["error","warning","info"].includes(r)?r:"error"}};c.__lovableEvents=Object.assign(Nt,{__userAppEventsSdkVersion:Ze,track:Fr,flush:()=>K(),identify(e){const t=e&&typeof e=="object"?e:null;it=typeof(t==null?void 0:t.user_id)=="string"?t.user_id:null},getIdentity(){return{app_user_id_hash_available:!!it}},getReplay(){return{replay_id:_,active:!!_&&!T&&_e,event_count:O}},resetIdentity(){it=null},captureException(e,t={},n={}){const r=Lt(e),o=Yr(n);let l=t&&typeof t=="object"&&!Array.isArray(t)?t:{};try{G(JSON.stringify(l))>4096&&(l={})}catch{l={}}A("lovable.client_error",{occurrence_id:M(),...r,...o,context:l})},startSpan(e,t={}){const n=new Date().toISOString(),r=x.now();return{end(o="ok"){A("lovable.frontend_span",{name:e,start_time:n,status:o,duration_ms:Math.max(0,x.now()-r),attributes:t})}}}}),c.addEventListener&&c.addEventListener("error",Jr,!0),Hr(),ot&&ie();const qn=Xr();if(c.addEventListener&&(c.addEventListener("error",e=>{const t=e&&typeof e=="object"?e:null,n=t!=null&&t.target&&typeof t.target=="object"?t.target:null;let r=null;if(n&&n!==c&&(typeof n.src=="string"?r=n.src:typeof n.href=="string"&&(r=n.href)),r!==null){const l=typeof(n==null?void 0:n.tagName)=="string"?n.tagName.toLowerCase():"unknown",a=Un(r);A("lovable.resource_error",{resource_type:l,url_host:a||Or(r)||"unknown",failure_type:"load_error",element:l,url_path:a?Ct(r):null,mechanism:"resource_load",handled:!1,severity:"error"});return}const o=Lt((t==null?void 0:t.error)||(t==null?void 0:t.message));A("lovable.client_error",{occurrence_id:M(),...o,filename:typeof(t==null?void 0:t.filename)=="string"?Ct(t.filename):null,lineno:typeof(t==null?void 0:t.lineno)=="number"?t.lineno:null,colno:typeof(t==null?void 0:t.colno)=="number"?t.colno:null,mechanism:"onerror",handled:!1,severity:"error"})},!0),c.addEventListener("unhandledrejection",e=>{const t=e&&typeof e=="object"?e:null,n=Lt(t==null?void 0:t.reason);A("lovable.client_error",{occurrence_id:M(),...n,mechanism:"unhandledrejection",handled:!1,severity:"error"})}),c.addEventListener("pagehide",()=>{Q=!0,qn(!0),Wr("pagehide"),Te("pagehide"),Je(),Ee(),Rt(),K(!0)}),c.addEventListener("blur",()=>jn()),c.addEventListener("focus",()=>{Pn(),pe&&(pe=!1,we())}),c.addEventListener("pageshow",e=>{(e&&typeof e=="object"?e.persisted:!1)===!0&&(Q=!1,hn(),Pn(),pe=!1,we())}),c.addEventListener("popstate",()=>Pt("popstate")),c.addEventListener("hashchange",()=>Pt("hashchange")),or)){const a={button:!0,a:!0,input:!0,select:!0,textarea:!0,summary:!0},i={button:!0,link:!0,menuitem:!0,menuitemcheckbox:!0,menuitemradio:!0,tab:!0,switch:!0,checkbox:!0,radio:!0,option:!0},u={header:!0,footer:!0,main:!0,nav:!0,aside:!0,section:!0,article:!0,form:!0},p=typeof Symbol!="undefined"&&typeof Symbol.for=="function"?Symbol.for("__jsxSource__"):null,y=s=>s&&typeof s=="object"&&typeof s.tagName=="string"?s:null,w={};for(const s of"html body div span main header footer nav aside section article form p a button input select textarea label fieldset legend optgroup option datalist output progress meter ul ol li dl dt dd table thead tbody tfoot tr td th caption col colgroup h1 h2 h3 h4 h5 h6 br hr pre blockquote figure figcaption small strong em b i u s q cite abbr code kbd samp var mark sub sup time address details summary dialog menu picture source track canvas iframe object embed param map area img video audio template slot noscript script style link meta title base head ins del ruby rt rp bdi bdo wbr data hgroup search fencedframe svg path g circle rect line polyline polygon ellipse text textpath tspan defs use symbol clippath mask pattern lineargradient radialgradient stop filter foreignobject marker image view desc animate animatetransform animatemotion set fegaussianblur feoffset feblend fecolormatrix fecomposite feflood femerge femergenode femorphology fetile feturbulence fedropshadow fedisplacementmap".split(" "))w[s]=!0;const I={};for(const s of"button link menuitem menuitemcheckbox menuitemradio tab switch checkbox radio option combobox listbox textbox searchbox slider spinbutton treeitem gridcell row columnheader rowheader tooltip dialog alertdialog navigation main banner contentinfo complementary region form search article list listitem table grid tree menu menubar toolbar tabpanel tablist progressbar status alert log timer none presentation".split(" "))I[s]=!0;const q={};for(const s of"button submit reset checkbox radio text password email number tel url search date time datetime-local month week color file range hidden image".split(" "))q[s]=!0;const Me=(s,d)=>s!==null&&d[s.toLowerCase()]===!0?s.toLowerCase():null,R=s=>{const d=String(s.tagName).toLowerCase();return w[d]===!0?d:"x"},Z=(s,d)=>{if(typeof s.getAttribute!="function")return null;const g=s.getAttribute(d);return typeof g=="string"&&g!==""?g:null},Xe=(s,d)=>typeof s.getAttribute=="function"&&typeof s.getAttribute(d)=="string",jt=(s,d,g)=>{const E=s.children;if(!E||typeof E.length!="number")return"";const v=E;let k=0,U=0;for(let H=0;H0?":"+k:""},Ce=s=>{const d=[];let g=s;for(let v=0;g&&v<32;v++){const k=R(g);if(!k||k==="html")break;const U=y(g.parentElement);if(d.unshift(U&&k!=="body"?k+jt(U,g,k):k),k==="body"||!U)break;g=U}if(d.length===0)return null;let E=d.join(">");for(;E.length>1024&&d.length>1;)d.shift(),E=d.join(">");return E.length>1024?E.slice(E.length-1024):E},Ye=s=>{if(p===null)return null;const d=s[p];if(!d||typeof d!="object")return null;const g=d.displayName;return typeof g=="string"&&g!==""?g:null},Ft=s=>{if(a[R(s)]===!0)return!0;const d=Z(s,"role");return d!==null&&i[d.toLowerCase()]===!0},h=(s,d)=>{const g=typeof s.composedPath=="function"?s.composedPath():null;if(Array.isArray(g)){const k=[];for(const U of g){if(k.length>=d)return{nodes:k,complete:!1};const H=y(U);H&&k.push(H)}return{nodes:k,complete:!0}}const E=[];let v=y(s.target);for(;v;){if(E.length>=d)return{nodes:E,complete:!1};E.push(v),v=y(v.parentElement)}return{nodes:E,complete:!0}},m=s=>s==="mouse"||s==="touch"||s==="pen",S=2e3,X=300;let P="",F=0;const Ae=s=>P!==""&&x.now()-F<=s?P:"";c.addEventListener("pointerdown",s=>{try{const d=s;if(d.isTrusted!==!0)return;const g=typeof d.pointerType=="string"?d.pointerType:"";m(g)&&(P=g,F=x.now())}catch{}},!0);const ee=s=>Math.round(s*1e3)/1e3,Le=s=>typeof s=="number"&&isFinite(s)?s:null;c.addEventListener("click",s=>{var d;try{if(!s||typeof s!="object")return;const g=s;if(g.isTrusted!==!0||ct>=200)return;const E=h(g,512);if(!E.complete)return;let v=null,k=null;for(let Qe=0;Qe=32)){if(v===null){Ft(Pe)&&(v=Pe);continue}k===null&&u[R(Pe)]===!0&&(k=Pe)}}if(v===null)return;const U=typeof g.pointerType=="string"?g.pointerType:"",H=(d=Le(g.detail))!=null?d:0,Ie=H===0?Ae(X):"",Hn=m(U)?U:Ie||(H===0?"keyboard":Ae(S)||"unknown");let Wn=null,Jn=null;const Gn=Le(g.clientX),Kn=Le(g.clientY),te=typeof v.getBoundingClientRect=="function"?v.getBoundingClientRect():null;Hn!=="keyboard"&&te&&Gn!==null&&Kn!==null&&te.width>0&&te.height>0&&(Wn=ee(Math.min(1,Math.max(0,(Gn-te.left)/te.width))),Jn=ee(Math.min(1,Math.max(0,(Kn-te.top)/te.height))));const Xn=c;A("lovable.element_clicked",{url_path:Nn(),element_tag:R(v),interaction_type:Hn,element_role:Me(Z(v,"role"),I),element_type:Me(Z(v,"type"),q),element_path:Ce(v),component_name:At(Ye(v),64),section_tag:k?At(R(k),64):null,offset_x:Wn,offset_y:Jn,viewport_width:Le(Xn.innerWidth),viewport_height:Le(Xn.innerHeight)}),ct++}catch{}},!0)}f&&typeof f.addEventListener=="function"&&f.addEventListener("visibilitychange",()=>{if(f.visibilityState==="hidden"){Q=!0,qn(),se(!0),Te("hidden"),Je(),Ee(),Rt(),K(!0),Q=!1;return}Q=!1,hn(),we()}),zn("pushState",()=>Pt("push_state")),zn("replaceState",qr),A("lovable.session_started",{reason:"new_session"}),It("initial_load",!1),we()})(window, "0.3.0-automated-flag", {"lovable.webmcp_tool_invoked":1,"lovable.session_started":1,"lovable.page_viewed":1,"lovable.client_error":1,"lovable.frontend_span":1,"lovable.interaction":1,"lovable.element_clicked":1,"lovable.form_submitted":1,"lovable.resource_error":1,"lovable.session_replay":1,"lovable.replay_error":1,"lovable.web_vital":1,"lovable.page_engagement":1}, 50, 51200);})();